package collection;

import java.util.LinkedList;
import java.util.Queue;

public class QueueDemo {
    public static void main(String[] args) {
        Queue<String> queue = new LinkedList<>();
        queue.offer("one");
        queue.offer("two");
        queue.offer("three");
        queue.offer("four");
        queue.offer("five");
        System.out.println(queue);

        String str = queue.poll();
        System.out.println(str);
        System.out.println(queue);

        str  = queue.peek();
        System.out.println(str);
        System.out.println(queue);

        for (String s:queue){
            System.out.println(s);
        }
        System.out.println(queue);


        while (queue.size()>0){
            String e=queue.poll();
            System.out.println(e);
        }
        System.out.println(queue);
    }
}
